{extend name="common:base"/}
{block name="body"}
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-12">
        <h2>系统设置</h2>
    </div>
</div>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>新增用户</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="#">选项1</a>
                            </li>
                            <li><a href="#">选项2</a>
                            </li>
                        </ul>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content p-xl-important">
                    <form class="form-horizontal" id="signupForm" method="post" action="{:\\think\\Url::build('User/add')}">
                        <div class="form-group input-large">
                            <label class=" control-label">用户名<span class="check-tips">（用户名会作为默认的昵称）</span></label>
                            <input class="form-control" type="text" name="username" value="">
                        </div>
                        <div class="form-group input-large">
                            <label class=" control-label">密码<span class="check-tips">(用户密码不能少于6位)</span></label>
                            <input class="form-control" id="password" type="password" name="password" value="">
                        </div>
                        <div class="form-group input-large">
                            <label class=" control-label">确认密码<span class="check-tips"></span></label>
                            <input  class="form-control" type="password" name="repassword" value="">
                        </div>
                        <div class="form-group input-large">
                            <label class=" control-label">邮箱<span class="check-tips">(用户邮箱，用于找回密码等安全操作)</span></label>
                            <input class="form-control" type="text" name="email" value="">
                        </div>
                        <div class="form-group">
                            <button class="btn btn-w-m btn-primary" target-form="form-horizontal" type="submit">提交</button>
                            <button class="btn btn-w-m btn-default retreat">取消</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

</div>
{/block}
{block name="script"}
<!-- 选择js 加载-->
<script type="text/javascript" src="__JS__/detail.js"></script>
<script src="__JS__/plugins/validate/jquery.validate.min.js"></script>
<script type="text/javascript">
    $(function () {
        highlight_subnav("{:\\think\\Url::build('user/index')}");
        $("#signupForm").validate({
            rules: {
                username: {
                    required: true,
                    minlength: 6
                },
                password: {
                    required: true,
                    minlength: 6
                },
                repassword: {
                    required: true,
                    minlength: 6,
                    equalTo: "#password"
                },
                email: {
                    required: true,
                    email: true
                }
            },
            messages: {
                username: {
                    required: "请输入您的用户名",
                    minlength: "用户名必须6-12位的英文字母包括下划线"
                },
                password: {
                    required: "请输入您的密码",
                    minlength: "密码必须6个字符以上"
                },
                repassword: {
                    required: "请再次输入密码",
                    minlength: "密码必须6个字符以上",
                    equalTo: "两次输入的密码不一致"
                },
                email: "请输入您的E-mail"
            },
            submitHandler: function () {
                validateAjax("#signupForm","button[type='submit']");
                return false;
            }
        });
    });
</script>
{/block}